package cn.wh.db.router.dynamic;

import cn.wh.db.router.DBContextHolder;
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;

/**
 * @Author wh
 * @Description 动态切换数据源
 * @Date 2023/3/28 15:34
 * @Version 1.0
 **/
public class DynamicDataSource extends AbstractRoutingDataSource {
    @Override
    protected Object determineCurrentLookupKey() {
        return "db" + DBContextHolder.getDBKey();
    }
}
